fix(seer): show GitLab icon for GitLab SCM links in evidence UI#118055
Conversation
git_search tool links hardcoded <IconGithub /> for all providers. Adds getScmIcon(url) that inspects the URL hostname and returns <IconGitlab /> for GitLab domains, falling back to <IconGithub />. Fixes CW-1528 Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Use params.provider (e.g. 'integrations:gitlab') instead of hostname sniffing to pick the right icon. The URL-based approach breaks for self-hosted GitLab instances whose domain doesn't contain 'gitlab'. Depends on getsentry/seer#7031 adding provider to the tool link params. Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
📊 Type Coverage Diff
🔍 1 new type safety issue introduced
This is informational only and does not block the PR. |
| if (provider === 'integrations:gitlab') { | ||
| return <IconGitlab />; | ||
| } | ||
| return <IconGithub />; |
There was a problem hiding this comment.
for old explorer runs we won;t have provider so im keeping github as the default
Reorder destructured keys to match the formatter's canonical output so the pre-commit `format` hook passes in CI. No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| if (provider === 'integrations:gitlab') { | ||
| return <IconGitlab />; | ||
| } | ||
| return <IconGithub />; |
There was a problem hiding this comment.
RepoProviderIcon might be a good import for here
| return { | ||
| href: commit_url, | ||
| icon: <IconGithub />, // TODO: support other SCMs | ||
| icon: <RepoProviderIcon provider={provider ?? 'integrations:github'} />, |
There was a problem hiding this comment.
Bug: The nullish coalescing operator for the provider parameter doesn't handle empty strings, causing a generic icon to be displayed instead of the intended default GitHub icon.
Severity: LOW
Suggested Fix
Replace the nullish coalescing operator with a more robust check to ensure provider is a non-empty string before use. For example: (provider && typeof provider === 'string') ? provider : 'integrations:github'. This will correctly handle null, undefined, and empty string cases by falling back to the default.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: static/app/components/events/autofix/v3/autofixEvidence.tsx#L329
Potential issue: The code uses `provider ?? 'integrations:github'` to set a default
value for the `provider` parameter. The nullish coalescing operator (`??`) only provides
a fallback for `null` or `undefined` values, not for an empty string (`""`). If the
backend sends an empty string for `provider`, it will be passed to the
`RepoProviderIcon` component. This component will not find `""` as a valid provider,
will log an error, and will render a generic `<IconOpen />` icon instead of the intended
default GitHub icon, leading to a degraded user experience.
Also affects:
static/app/components/events/autofix/v3/autofixEvidence.tsx:345~345
There was a problem hiding this comment.
it should never be an empty string
## Problem
For GitLab repos, `repo.name` is `name_with_namespace` — the
human-readable display name, e.g. `"My Group / My Project"` (spaces
around the slash). Splitting this on `/` to extract `owner` and `name`
produces parts with leading/trailing whitespace, which causes Seer to
construct SCM links that 404.
Root cause confirmed by comparing the GitLab integration's own
`format_source_url`, which already uses `repo.config["path"]`
(`path_with_namespace`, e.g. `"my-group/my-project"`) to build valid
URLs.
## Changes
**Introduce `get_repo_url_path(repo)` helper** in
`seer/autofix/utils.py`:
- Returns `repo.config["path"]` for `integrations:gitlab` repos
(URL-safe `path_with_namespace`).
- Returns `repo.name` unchanged for GitHub and all other providers.
Applied at the four call sites that previously did
`repo.name.split("/")`:
- `seer/autofix/utils.py` — `build_repo_definition_from_project_repo`
and `get_autofix_repos_from_project_code_mappings`
- `seer/endpoints/project_seer_repos.py` — `_serialize_project_repo`
- `seer/agent/tools.py` — `get_repository_definition`
Companion frontend fix (icon): #118055
Fixes https://linear.app/getsentry/issue/CW-1528
---
[View Session in
Sentry](https://sentry.sentry.io/traces/?project=4510944073809921&query=gen_ai.conversation.id%3A%22slack%3AC013P75SQUB%3A1781810595.615099%22)
---------
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Problem
git_searchtool links hardcoded<IconGithub />for all SCM providers.Change
Reads
params.provider(e.g.'integrations:gitlab') from the tool link params and passes it togetScmIcon(). Returns<IconGitlab />for GitLab,<IconGithub />for everything else.Using the explicit provider string (rather than URL hostname sniffing) means this works correctly for self-hosted GitLab instances whose domain doesn't contain
'gitlab'.Depends on getsentry/seer#7031 which adds
providerto thegit_searchtool link params.Companion backend fix: #118054
Fixes https://linear.app/getsentry/issue/CW-1528
View Session in Sentry